<div id="judge-area">

    <div class="form-group">
        <label for="input-judge-type" class="col-sm-1 control-label">规则</label>
        <div class="col-sm-3">
            <select class="form-control" id="rule-judge-type">
                <option value="0" {@if r.judge.type==0 } selected {@/if}>单一条件匹配</option>
                <option value="1" {@if r.judge.type==1 } selected {@/if}>and匹配</option>
                <option value="2" {@if r.judge.type==2 } selected {@/if}>or匹配</option>
                <option value="3" {@if r.judge.type==3 } selected {@/if}>复杂匹配</option>
            </select>
        </div>

        <div class="col-sm-8" id="expression-area" {@if r.judge.type != "3" } style="display:none;" {@/if}>
             <input type="text" class="form-control" id="rule-judge-expression" value="${r.judge.expression}" placeholder="规则表达式，示例: (v[1] or v[2]) and v[3]">
        </div>
    </div><!-- 类型 -->

    {@each r.judge.conditions as c, index}
        <div class="form-group pair condition-holder">
            <label class="col-sm-1 control-label"></label>

            <div class="col-sm-2">
                <select class="form-control" name="rule-judge-condition-type">
                    <option value="URI" {@if c.type == "URI" } selected {@/if}>URI</option>
                    <option value="Header" {@if c.type == "Header" } selected {@/if}>Header</option>
                    <option value="Query" {@if c.type == "Query" } selected {@/if}>Query</option>
                    <option value="PostParams" {@if c.type == "PostParams" } selected {@/if}>PostParams</option>
                    <option value="IP" {@if c.type == "IP" } selected {@/if}>IP</option>
                    <option value="UserAgent" {@if c.type == "UserAgent" } selected {@/if}>UserAgent</option>
                    <!-- <option value="Method" {@if c.type == "Method" } selected {@/if}>Method</option> -->
                    <option value="Host" {@if c.type == "Host" } selected {@/if}>Host</option>
                    <option value="Referer" {@if c.type == "Referer" } selected {@/if}>Referer</option>
                </select>
            </div>
            <div class="col-sm-2 condition-name-hodler" {@if c.type!="Header"&&c.type!="Query"&&c.type!="PostParams" } style="display:none;" {@/if}>
                <input type="text" class="form-control" name="rule-judge-condition-name" placeholder="name" value="${c.name}">
            </div>
            <div class="col-sm-3">
                <select class="form-control"  name="rule-judge-condition-operator">
                    <option value="match" {@if c.operator=="match" } selected {@/if}>Match</option>
                    <option value="not_match" {@if c.operator=="not_match" } selected {@/if}>Not Match</option>
                    <option value="=" {@if c.operator=="="} selected {@/if}>=</option>
                    <option value="!=" {@if c.operator=="!="} selected {@/if}>!=</option>
                    <option value=">" {@if c.operator==">" } selected {@/if}>&gt;</option>
                    <option value=">=" {@if c.operator==">=" } selected {@/if}>&ge;</option>
                    <option value="<" {@if c.operator=="<"} selected {@/if}>&lt;</option>
                    <option value="<=" {@if c.operator=="<="} selected {@/if}>&le;</option>
                </select>
            </div>
            <div class="col-sm-3">
                <input type="text" class="form-control" name="rule-judge-condition-value" placeholder="value" value="${c.value}">
            </div>
            <div class="col-sm-1" style="margin-top:10px">
                <span class="input-group-btn">
                    <a class="btn btn-danger" style="padding:0 5px;">
                        <i class="fa fa-remove"></i>
                    </a>
                    <a class="btn btn-success" style="padding:0 5px;">
                        <i class="fa fa-plus"></i>
                    </a>
                </span>
            </div>
        </div>
    {@/each}

</div>
<!-- judge -->